// scaup - Scala up!
// (c) 2008-2010, Normen Müller, normen.mueller@gmail.com  
// $Id: lists.scala 47 2010-01-12 20:22:35Z normen.mueller $
package scaup.data

/** Adds extra methods to <code>scala.List[T]</code>.
 * 
 * @param list to enclose/ extend 
 * @author <a href="mailto:normen.mueller@googlemail.com">Normen M&#xFC;ller</a>
 * @version 0.0.3 */
private [scaup] class ListExtras[T](list: List[T]) {
  import scaup.Views._
  
  /** Returns the longest suffix of this list with prefix list <code>that</code>.
   * 
   * @param  that the prefix list
   * @return the longest suffix of this list with prefix list <code>that</code>. */
  def ---(that: List[T]): List[T] = (list, that) match {
    case (hl::tl,hr::tr) if hl == hr => tl --- tr
    case (h,_)                       => h
  }
}
